import java.util.Timer;
import java.util.TimerTask;

/**
 * java自带的定时任务Timer
 */
public class JavaTimerTest {
    public static void main(String[] args) {

        Timer timer=new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                System.out.println("xxxxxx");
            }
        },3000,1000);//3秒后每次经过1秒钟执行一次
    }
}
